** Add here code to illustrate the tax schedule, as well as code to show a graph of the annual tax payment distribution for each vehicle: 

clear all 

set obs 41 

gen weight=100*_n-100

gen tax=.
replace tax=weight*0.24 if weight<=1000
replace tax=240+(weight-1000)*0.24*0.86 if weight<=2000 & weight>1000
replace tax=240+206.4+(weight-2000)*0.24*0.86^2 if weight<=3000 & weight>2000
replace tax=240+206.4+177.504+(weight-3000)*0.24*0.86^3 if weight>3000 

gen tax_EV=0.5*0.4*tax
gen tax_A=0.6*tax
gen tax_B=0.8*tax
rename tax tax_CG



reshape long tax_, i(weight) j(cat) string

set scheme white_tableau
colorpalette Tab10, gscale n(4) nograph


graph twoway (line tax_ weight if cat=="EV", lpattern(solid) lcolor(`r(p1)')) (line tax_ weight if cat=="A", lpattern(shortdash) lcolor(`r(p2)')) (line tax_ weight if cat=="B", lpattern(dash_dot) lcolor(`r(p3)')) (line tax_ weight if cat=="CG", lpattern(shortdash_dot) lcolor(`r(p4)')) , xtitle("Vehicle weight (Kg)") ytitle("Annual tax payment (CHF)") legend(on pos(6) label(1 "EV") label(2 "Category A") label(3 "Category B") label(4 "Base tax (C-G)") rows(1))

graph export "$root/Results/tables_graphs/main/tax_schedule.png", replace

clear all 

use "$root/Data/Produced/EV_welfare04.dta", clear

drop if missing(choice)

collapse (lastnm) car_tax weight (firstnm) drivetype (sum) choice, by(car_option)

set scheme white_tableau
colorpalette Tab10, gscale n(4) nograph


graph twoway (scatter car_tax weight if drivetype==1 [w=choice], msymbol(oh) msize(small) mcolor(`r(p1)')) (scatter car_tax weight if drivetype==2 [w=choice], msymbol(dh) msize(small) mcolor(`r(p2)')) (scatter car_tax weight if drivetype==3 [w=choice], msymbol(th) msize(small) mcolor(`r(p3)')) (scatter car_tax weight if drivetype==4 [w=choice], msymbol(sh) msize(small) mcolor(`r(p4)')), legend(on pos(6) label(1 "Gasoline") label(2 "Diesel") label(3 "EV") label(4 "Hybrid") rows(1))  xtitle("Vehicle weight (Kg)") ytitle("Annual vehicle tax (CHF)")


	
graph export "$root/Results/tables_graphs/main/tax_dist.png", replace

**Create a graph of the density of vehicle miles travelled: 

use "$root/Data/Produced/EV_welfare04.dta", clear

keep if choice==1 

set scheme white_tableau

histogram average_use_var, kdensity frequency xtitle("Average Kilometres driven")

graph export "$root/Results/tables_graphs/appendix/vmt_distribution.png", replace


*Create graph that illustrates different feebate policy combinations: 
use "$root/Data/Original/tax_params_ext.dta" , clear

rename EV_K K_EV
rename A_K K_A
rename B_K K_B
rename E_K K_E
rename F_K K_F
rename G_K K_G
gen K_C=0
gen K_D=0

reshape long K_, i(tax_sim) j(type) string

gen typ=0
replace typ=1 if type=="A"
replace typ=2 if type=="B"
replace typ=3 if type=="C"
replace typ=4 if type=="D"
replace typ=5 if type=="E"
replace typ=6 if type=="F"
replace typ=7 if type=="G"

label define type 0 "EV" 1 "A" 2 "B" 3 "C" 4 "D" 5 "E" 6 "F" 7 "G"
label values typ type

frame put _all, into(graph)
frame change graph

collapse (min) min_K=K_ (max) max_K=K_, by(typ)

replace min_K=100*min_K
replace max_K=100*max_K

set scheme white_tableau

twoway (rarea min_K max_K typ, sort), ytitle(Feebate (%)) yline(0) xtitle(Environmental category) xlabel(0(1)7, valuelabel) 

graph export "$root/Results/tables_graphs/appendix/feebate_area.png", replace

